const Koa = require("koa");
const Router = require("koa-router");
const static = require("koa-static");
const koaBody = require("koa-body");
let data = require("./data.json");
let app = new Koa();
let router = new Router();
app.use(koaBody());
app.use(static(__dirname+"/static"));

router.get("/test",ctx=>{
    ctx.body = {
        name:"张三",
        age:20
    }
})

router.get("/seller",ctx=>{
    ctx.body = data.seller;
})
router.get("/goods",ctx=>{
    ctx.body = data.goods;
})

app.use(router.routes());
app.listen(8989);
